package com.dream.service2.exception;

import com.dream.service2.utils.ReturnUtils;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class CommonException extends RuntimeException {
    @ResponseStatus(HttpStatus.UNAUTHORIZED)
    @ExceptionHandler(value = RuntimeException.class)
    public ReturnUtils handler(RuntimeException e) {
        return ReturnUtils.erro("630", e.getMessage(), null);
    }

}

